package ru.st.selenium.pages;

import static org.openqa.selenium.support.ui.ExpectedConditions.alertIsPresent;
import static org.openqa.selenium.support.ui.ExpectedConditions.presenceOfElementLocated;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

public class FilmOverviewPage extends InternalPage {

	public FilmOverviewPage(PageManager pages) {
		super(pages);
	}
	
	@FindBy(xpath = "//img[@title='Remove']")
	private WebElement removeFilmField;
	
	public FilmOverviewPage clickRemoveButton() {
	    removeFilmField.click();
	    wait.until(alertIsPresent()).accept();
	    return pages.filmOverviewPage;
	  }
	
		
	public FilmOverviewPage ensurePageLoaded() {
	    super.ensurePageLoaded();
	    wait.until(presenceOfElementLocated(By.id("movie")));
	    return this;
	  }   

}
